package com.hfkf.javaoop;

import java.util.Scanner;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class TestvIVisitor {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

//          调用 buy 方法
        Visitor1 liming = new Visitor1();

        String resp = null;
        for (;;){
            System.out.print("请输入游客姓名：");
            liming.name = sc.next();
            System.out.print("请输入游客年龄：");
            liming.age = sc.nextInt();

            int price = liming.buy();

            System.out.println(liming.name+"的年龄："+liming.age+"岁"+"\t\t\t"+(price==0?"门票免费":"门票价格为："+price+"元。"));
            System.out.print("\n");
            System.out.println("是否继续购票（y(是)|n（否））:");
            resp = sc.next();
            if (!"y".equalsIgnoreCase(resp)){
                break;
            }
        }
        System.out.println("欢迎下次光临！");
    }
}
